package mobi.hami.huapin.dao;

import mobi.hami.huapin.daobase.CrudMapper;
import mobi.hami.huapin.dto.NoteInfoForUserDTO;
import mobi.hami.huapin.model.NoteInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface NoteInfoMapper extends CrudMapper<NoteInfo> {

    @SelectProvider(type = NoteInfoProvider.class,method = "selectNoteinfosWitchParam")
    List<NoteInfo> selectNoteinfosWitchParam(Map<String,Object> parms);

    /**
     * 用户提交的，只显示最新一个
     * @param userid
     * @return
     */
    @Select("select id,comtent as content  from note_info where creator_id = #{userid} order by id desc")
    List<NoteInfoForUserDTO> queryUserNotes(@Param("userid") int userid);
}